/**
 * @author Administrator
 * 权限组列表
 */
var sort = null;  
Ext.onReady(function(){
		 Ext.BLANK_IMAGE_URL=Ext.get('basePath').getValue()+"ajaxFramework/ext-2.1/resources/images/default/s.gif";

	var colModel = new Ext.grid.ColumnModel([
		{header:'序号',dataIndex:'ordernumber',menuDisabled : true},
		{header:'组名称',dataIndex:'groupname',menuDisabled : true},
		{header:'操作',dataIndex:'operate',menuDisabled : true,renderer:function(s,m,rec){
		return "<a  href="+"javascript:selectrolesgroupuser('"+rec.data.id+"')>查看权限组下的人员</a>";
		}},
		{header:'id',dataIndex:'id',hidden:true}
	]);
	var url = Ext.get('basePath').getValue()+'tjsinfo/tjsoa/system/rolesGroupList.do';
	sort = new Ext.data.JsonStore({
		url:url,
		fields:['ordernumber','groupname','id'],
		root:'root',
		totalProperty:'totalProperty'
	});
	var bbar = new Ext.PagingToolbar({
		pageSize:10,
		store:sort,
		displayInfo:true,
		emptyMsg:'没有记录'
	});
	
	var grid = new Ext.grid.GridPanel({
		title:'权限组列表',
		cm:colModel,
		renderTo:'topic-grid',
		store:sort,
		loadMask:true,
		autoHeight:true,
		tbar:[{
			 text: '添加',
             iconCls: 'silk-add'
		}],
		bbar:bbar,
		viewConfig:{
			forceFit:true
		}
	});
	sort.load();
});
/**
 * 显示权限组下的人员放在window中呈现
 * @param {} 权限组ID
 */
function selectrolesgroupuser(rolesgroupid){
	 var url = Ext.get('basePath').getValue()+'tjsinfo/tjsoa/system/userByRolesGroup.do?rolesgruopid='+rolesgroupid;
	 var load = new Ext.tree.TreeLoader({
	 	  dataUrl:url
	 });
	 var root = new Ext.tree.AsyncTreeNode({
	 	id:'0',
	 	text:'天津利达粮油有限公司'
	 })
	 var tree = new Ext.tree.TreePanel({
	 		x:5,
	 		y:5,
        	autoScroll: true,
        	animate: true,
        	containerScroll: true,
        	border: true,
        	frame:true,
	        loader:load,
	        height:467,
	        width:505
	    });
	tree.setRootNode(root); 
	var win = new Ext.Window({
		title:'人员列表',
		width:520,
		height:500,
		modal:true,
		frame:true,
		closeAction:'hide',
		items:tree
	});
	win.show();
}